
//
//  BMSRealnameValidator.h
//  WDBMS
//
//  Created by YeJary on 2025/5/27.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

#pragma mark - 验证结果类

@interface BMSValidationResult : NSObject

@property (nonatomic, assign, readonly) BOOL isValid;
@property (nonatomic, copy, readonly, nullable) NSString *errorMessage;

+ (instancetype)successResult;
+ (instancetype)failureResultWithMessage:(NSString *)message;

@end

@interface BMSRealnameValidationResult : NSObject

@property (nonatomic, assign, readonly) BOOL isValid;
@property (nonatomic, copy, readonly, nullable) NSString *nameError;
@property (nonatomic, copy, readonly, nullable) NSString *idCardError;

+ (instancetype)successResult;
+ (instancetype)failureResultWithNameError:(nullable NSString *)nameError
                               idCardError:(nullable NSString *)idCardError;

@end

#pragma mark - 验证器主类

@interface BMSRealnameValidator : NSObject

// 单项验证
- (BMSValidationResult *)validateName:(NSString *)name;
- (BMSValidationResult *)validateIDCard:(NSString *)idCard;

// 组合验证
- (BMSRealnameValidationResult *)validateRealnameWithName:(NSString *)name
                                                   idCard:(NSString *)idCard;

// 辅助方法
- (BOOL)isValidChineseName:(NSString *)name;
- (BOOL)isValidIDCardNumber:(NSString *)idCard;
- (NSString *)extractBirthdayFromIDCard:(NSString *)idCard;
- (BOOL)isTeenagerWithIDCard:(NSString *)idCard;

@end

NS_ASSUME_NONNULL_END
